<?
#####################################################
#  COPYRIGHT NOTICE
#####################################################
# In the following statements, the term "this 
# program" refers to all files associated with the
# execution and distribution of Adtrackz.
#
# This Program is Copyright 2004 Jonah Klimack.
# All Rights Reserved. 
#
# Selling the code for this program, modifying 
# and/or redistributing the code for this program
# in part or in whole over the Internet or in any 
# other medium is expressly forbidden. Violators
# will be prosecuted to the fullest extent of the law
# Copyright and header information may not be
# modified.
#
# This program is distributed "as is" and without 
# warranty of any kind, either express or implied.
# In no event shall the liability of Jonah Klimack 
# for any damages, losses and/or causes of 
# action exceed the total amount paid by the 
# user for this software.		
#####################################################
# DO NOT MODIFY ANYTHING IN THIS FILE
#####################################################

require "config.php";

########################################################################################
#    YEARLY
########################################################################################

$campaign = mysql_fetch_row(mysql_query("select * from adtrackz_campaigns where ID='$cID'"));
$clickdata = mysql_query("select timest from adtrackz_clicks where campaignID='$cID' && subID='$sID'");
$uclickdata = mysql_query("select timest from adtrackz_clicks where campaignID='$cID' && subID='$sID' && uniqueflag=1");

while ($click = mysql_fetch_row($clickdata))
{
	//get month 
	$time = getdate($click[0]);
	$clickyear = $time['year'];
	$yc[$clickyear] += 1;
}
if (!$yc)
	$yc = array_fill (1,10,0);
else
	ksort($yc);

while ($uclick = mysql_fetch_row($uclickdata))
{
	//get month 
	$time = getdate($uclick[0]);
	$clickyear = $time['year'];
	$uyc[$clickyear] += 1;
}
if (!$uyc)
	$uyc = array_fill (1,10,0);
else
	ksort($uyc);


//label for graph
$month_label = "Yearly Clicks";

include 'charts.php';

$chart[ 'chart_data' ] = array ( array ("","2005","2006","2007","2008","2009","2010","2011","2012","2013","2014","2015"), array ( "Unique Clicks",$uyc['2005'],$uyc['2006'],$uyc['2007'],$uyc['2008'],$uyc['2009'],$uyc['2010'],$uyc['2011'],$uyc['2012'],$uyc['2013'],$uyc['2014'],$uyc['2015']),array ( "Raw Clicks",$yc['2005'],$yc['2006'],$yc['2007'],$yc['2008'],$yc['2009'],$yc['2010'],$yc['2011'],$yc['2012'],$yc['2013'],$yc['2014'],$yc['2015']) );

$chart[ 'axis_category' ] = array ( 'font'=>"arial", 'bold'=>true, 'size'=>12, 'color'=>"000022", 'alpha'=>75, 'skip'=>2 ); 
$chart[ 'axis_value' ] = array ( 'font'=>"arial", 'bold'=>true, 'size'=>10, 'color'=>"000022", 'alpha'=>75, 'steps'=>4, 'prefix'=>"", 'suffix'=>"", 'decimals'=>0, 'separator'=>"", 'show_min'=>false );

$chart[ 'chart_bg' ] = array ( 'positive_color'=>"448800", 'negative_color'=>"ffeeAA", 'positive_alpha'=>20, 'negative_alpha'=>100 );
$chart[ 'chart_border' ] = array ( 'color'=>"000000", 'top_thickness'=>1, 'bottom_thickness'=>1, 'left_thickness'=>1, 'right_thickness'=>1 );
$chart[ 'chart_rect' ] = array ( 'x'=>60, 'y'=>50, 'width'=>400, 'height'=>200 );
//$chart[ 'chart_type' ] = "stacked column"; 
$chart[ 'chart_type' ] = "column"; 
//$chart[ 'chart_type' ] = "Line";

$chart[ 'draw_text' ] = array (	
						array ( 'color'=>"663333", 'alpha'=>75, 'font'=>"arial", 'rotation'=>0, 'bold'=>true, 'size'=>14, 'x'=>60, 'y'=>50, 'width'=>300, 'height'=>300, 'text'=>$month_label, 'h_align'=>"right", 'v_align'=>"top" ) );

$chart[ 'legend_rect' ] = array ( 'x'=>-100, 'y'=>-100, 'width'=>10, 'height'=>10, 'margin'=>0 ); 

//$chart[ 'series_color' ] = array ( "4e627c", "c89341" );
$chart[ 'series_color' ] = array ( "FFFFFF", "FA7F14" );
$chart[ 'series_gap' ] = array ( 'set_gap'=>0, 'bar_gap'=>0 );

$chart[ 'legend_bg' ] = array ( 'bg_color'=>"ffffff", 'bg_alpha'=>35, 'border_color'=>"000000", 'border_alpha'=>0, 'border_thickness'=>0 ); 
$chart[ 'legend_label' ] = array ( 'layout'=>"horizontal", 'font'=>"arial", 'bold'=>true, 'size'=>13, 'color'=>"444466", 'alpha'=>90 ); 
$chart[ 'legend_rect' ] = array ( 'x'=>125, 'y'=>10, 'width'=>250, 'height'=>10, 'margin'=>5 ); 

SendChartData ( $chart );


?>
